Python: Parse class bases like function arguments - #22301
Conversation
|
Good |
|
Hi. Thanks for your contribution; could you perhaps add some test cases as well? |
I can try. It's not really clear to me how the parser tests work. Do I see it correctly that in |
Yes, that looks like the right place to add the tests (example: #17822). |
|
@hvitved thanks for the pointers! Created, verified and added a test with expected output. This should cover just about all cases of expressions regularly used as class bases. |
This PR adjusts how class bases are parsed to match the parsing of function arguments.
Previously, any node with a
valuefield was excluded to reject dict-splats as bases; this would also reject many other valid nodes, critically subscripts as used for typing (e.g.list[int]). Now, the undesired node types are explicitly rejected.Closes #22298.